/*mPjGvvnKekcg9tkn8N4Q1xKFxkm2UCYjz3ErNtXVv+A+b2BUM4JR09RbfIiiGLAD*/
/*
 * @Descripttion:
 * @version:
 * @Author: Chendch
 * @Date: 2018-10-10 17:36:07
 * @LastEditors: Chendch
 * @LastEditTime: 2021-04-29 15:45:08
 */
import {viewModel} from "nc-lightapp-front";
const {setGlobalStorage, getGlobalStorage, removeGlobalStorage, getStorage: getStorageType} = viewModel;

/**
 * @desc  设置本地数据存储
 * @param {String} key
 * @param {String} value
 * @param {String} type localStorage:本地 长效,session:会话式
 */
export const setStorage = (key, value, type = 'localStorage') => {
    setGlobalStorage(type, key, value);
}

/**
 * @desc  获取本地数据存储
 * @param {String} key
 * @param {String} value
 * @param {String} type localStorage:本地 长效,session:会话式
 */
export const getStorage = (key, type = 'localStorage') => {
    return getGlobalStorage(type, key);
}

/**
 * @desc  清除本地数据存储
 * @param {String} key
 * @param {String} value
 * @param {String} type localStorage:本地 长效,session:会话式
 */
export const removeStorage = (key, type = 'localStorage') => {
    return removeGlobalStorage(type, key)
}

/**
 * @desc  清除本地所有数据存储
 * @param {String} key
 * @param {String} type localStorage:本地 长效,session:会话式
 */
export const clearStorage = (type = 'localStorage') => {
    getStorageType(type).clear()
}

/*mPjGvvnKekcg9tkn8N4Q1xKFxkm2UCYjz3ErNtXVv+A+b2BUM4JR09RbfIiiGLAD*/
